const workloadIdentityPoolProviderIdRegexp = `^[0-9a-z-]+$`

func validateWorkloadIdentityPoolProviderId(v interface{}, k string) (ws []string, errors []error) {
    value := v.(string)

    if strings.HasPrefix(value, "gcp-") {
        errors = append(errors, fmt.Errorf(
            "%q (%q) can not start with \"gcp-\"", k, value))
    }

    if !regexp.MustCompile(workloadIdentityPoolProviderIdRegexp).MatchString(value) {
       errors = append(errors, fmt.Errorf(
            "%q must contain only lowercase letters (a-z), numbers (0-9), or dashes (-)", k))
    }

    if len(value) < 4 {
        errors = append(errors, fmt.Errorf(
            "%q cannot be smaller than 4 characters", k))
    }

    if len(value) > 32 {
        errors = append(errors, fmt.Errorf(
            "%q cannot be greater than 32 characters", k))
    }

    return
}
